package com.mdd.admin.service.system.impl;

import com.mdd.admin.service.system.ISystemConsumptionRewardConfigService;
import com.mdd.admin.validate.system.SystemConsumptionRewardConfigParam;
import com.mdd.common.utils.LsConfigUtil;
import org.springframework.stereotype.Service;

@Service
public class SystemConsumptionRewardConfigServiceImpl implements ISystemConsumptionRewardConfigService {

    /**
     * 新增或更新 积分抵扣规则
     *
     * @author panweiliang
     * @param systemConsumptionRewardConfigParam 参数
     */
    @Override
    public void addOrUpdate(SystemConsumptionRewardConfigParam systemConsumptionRewardConfigParam) {
        LsConfigUtil.set("consumption_reward", "enable", String.valueOf(systemConsumptionRewardConfigParam.getEnable()));
        LsConfigUtil.set("consumption_reward", "award_object", String.valueOf(systemConsumptionRewardConfigParam.getAward_object()));
        LsConfigUtil.set("consumption_reward", "reward_method", String.valueOf(systemConsumptionRewardConfigParam.getReward_method()));
        LsConfigUtil.set("consumption_reward", "event", String.valueOf(systemConsumptionRewardConfigParam.getEvent()));
        LsConfigUtil.set("consumption_reward", "integral_method", String.valueOf(systemConsumptionRewardConfigParam.getIntegral_method()));
        LsConfigUtil.set("consumption_reward", "integral_value", String.valueOf(systemConsumptionRewardConfigParam.getIntegral_value()));
    }
}
